<?php foreach ($fields as $field => $vo): ?>
    <?php $value = emptyDef($vo['value'],$data[$field],'isset'); ?>

    <?php if ($vo['type'] == 'text'): ?>
    <div class="mb-3 col-md-12">
      <label for="{:$field}" class="form-label">{:$vo['name']} {:validsHtml($vo['valids'])}</label>
      <input type="text" class="form-control" id="{:$field}" name="{:$field}" value="{:$value}" placeholder="{:$vo['placeholder']}" />
    </div>
    <?php elseif ($vo['type'] == 'file'): ?>
    <div class="mb-3 col-md-12 position-relative">
      <!-- <label for="{:$field}">多图上传</label> -->
      <div class="js-upload-images">
        <div id="picker_{:$field}">上传{:$vo['name']}</div>
        <input type="hidden" name="{:$field}" data-url="{:$vo['url']}" data-multiple="false" data-ext='gif,jpg,jpeg,bmp,png,pdf,doc,docx,xls,xlsx,txt' id="{:$field}" value="{:$value}">
        <ul id="file_list_{:$field}" class="list-inline row lyear-uploads-pic mb-0">
          <?php if (!empty($value)): ?>
            <li class="col-6 col-sm-3 col-md-2 list-images-item">
              <figure>
                <?php if (!in_array(pathinfo($value)['extension'],['gif','jpg','jpeg','bmp','png'])): ?>
                    <img src="__STATIC__/common/common_file.jpg" />
                <?php else: ?>
                    <img src="__UPLOAD__/{:$value}" />  
                <?php endif ?>
                <figcaption>
                  <a class="btn btn-round btn-primary btn-link-pic" href="__UPLOAD__/{:$value}"><i class="mdi mdi-eye"></i></a>
                  <a class="btn btn-round btn-danger btn-remove-pic" data-id="1"><i class="mdi mdi-delete"></i></a>
                </figcaption>
              </figure>
            </li>
          <?php endif ?>
        </ul>
      </div>
    </div>
    <?php elseif ($vo['type'] == 'files'): ?>
    <div class="mb-3 col-md-12 position-relative">
      <!-- <label for="{:$field}">多图上传</label> -->
      <div class="js-upload-images">
        <div id="picker_{:$field}">上传{:$vo['name']}</div>
        <input type="hidden" name="{:$field}" data-url="{:$vo['url']}" data-multiple="true" id="{:$field}" value="{:$value}">
        <ul id="file_list_{:$field}" class="list-inline row lyear-uploads-pic mb-0">
          <?php if (!empty($value)): ?>
            <?php $values = explode(',',$value); ?>
            <?php foreach ($values as $tmp_k => $tmp_v): ?>
            <li class="col-6 col-sm-3 col-md-2 list-images-item">
              <figure>
                <?php if (!in_array(pathinfo($tmp_v)['extension'],['gif','jpg','jpeg','bmp','png'])): ?>
                    <img src="__STATIC__/common/common_file.jpg" />
                <?php else: ?>
                    <img src="__UPLOAD__/{:$tmp_v}" />  
                <?php endif ?>
                <figcaption>
                  <!-- <a class="btn btn-round btn-primary btn-link-pic" href="__UPLOAD__/{:$tmp_v}"><i class="mdi mdi-eye"></i></a> -->
                  <a class="btn btn-round btn-primary" target="_blank" href="__UPLOAD__/{:$tmp_v}" download="{:$tmp_v}" title="下载"><i class="mdi mdi-download"></i></a>
                  <a class="btn btn-round btn-danger btn-remove-pic" data-id="{:$tmp_v}"><i class="mdi mdi-delete"></i></a>
                </figcaption>
              </figure>
            </li>
            <?php endforeach ?>
          <?php endif ?>
        </ul>
      </div>
    </div>
    <?php elseif ($vo['type'] == 'disabled'): ?>
    <div class="mb-3 col-md-12">
      <label for="{:$field}" class="form-label">{:$vo['name']} {:validsHtml($vo['valids'])}</label>
      <input type="text" class="form-control" id="{:$field}" value="{:$value}" disabled />
    </div>
    <?php elseif (in_array($vo['type'], ['select1','select1_1'])): ?>
    <div class="mb-3 col-md-12">
      <label for="{:$field}" class="form-label">{:$vo['name']} {:validsHtml($vo['valids'])}</label>
      <select class="form-select" id="{:$field}" name="{:$field}">
          <?php if ($vo['type'] == 'select1_1'): ?>
              <option value="">请选择</option>
          <?php endif; ?>
          <?php foreach ($vo['params'] as $param_k => $param_v): ?>
              <option value="{:$param_k}" {:isset($value) && $param_k==$value?'selected':''}>{:$param_v}</option>
          <?php endforeach ?>
      </select>
    </div>
    <?php elseif (in_array($vo['type'], ['select2','select2_1'])): ?>
    <div class="mb-3 col-md-12">
        <label for="{:$field}" class="form-label">{:$vo['name']} {:validsHtml($vo['valids'])}</label>
        <select class="form-select js-select2" name="{:$field}" id="{:$field}">
          <?php if ($vo['type'] == 'select2_1'): ?>
              <option value="">请选择</option>
          <?php endif; ?>
          <?php foreach ($vo['params'] as $param_k => $param_v): ?>
              <option value="{:$param_k}" {:isset($value) && $param_k==$value?'selected':''}>{:$param_v}</option>
          <?php endforeach ?>
        </select>
    </div>
    <?php elseif ($vo['type'] == 'checkbox'): ?>
    <?php $checkbox_data = empty($value)?[]:explode(',', $value); ?>
    <div class="mb-3 col-md-12">
        {include file="html/fields/checkbox" /}
    </div>
    <?php elseif ($vo['type'] == 'textarea'): ?>
    <div class="mb-3 col-md-12">
      <label for="{:$field}" class="form-label">{:$vo['name']} {:validsHtml($vo['valids'])}</label>
      <textarea class="form-control" id="{:$field}" name="{:$field}" rows="4" placeholder="{:$vo['placeholder']}">{:$value}</textarea>
    </div>
    <?php elseif ($vo['type'] == 'date'): ?>
    <div class="mb-3 col-md-12">
        <label for="{:$field}" class="form-label">{:$vo['name']} {:validsHtml($vo['valids'])}</label>
        <input type="text" class="form-control" data-provide="datepicker" data-autoclose="true" id="{:$field}" name="{:$field}" value="{:$value}" placeholder="{:$vo['placeholder']}" />
    </div>
    <?php elseif ($vo['type'] == 'ueditor'): ?>
    <div class="mb-3 col-md-12">
        <label for="{:$field}" class="form-label">{:$vo['name']} {:validsHtml($vo['valids'])}</label>
        <textarea id="{:$field}" class="ueditor" name="{:$field}" placeholder="{:$vo['placeholder']}">{:$value}</textarea>
    </div>



    
    
    
    
   
    
    <?php elseif ($vo['type'] == 'tags'): ?>
    <div class="form-group col-md-12">
        <label for="{:$field}">{:$vo['name']}</label>
        
            <input class="js-tags-input form-control" type="text" id="{:$field}" name="{:$field}" value="{:$value}" />
    </div>
    <?php elseif ($vo['type'] == 'datetime'): ?>
    <div class="form-group col-md-12">
        <label for="{:$field}">{:$vo['name']} {:in_array('required',$vo['valids'])?'<span class="text-orange">*</span>':''}</label>
        
            <input class="js-datetimepicker form-control" autocomplete="off" id="{:$field}" name="{:$field}" placeholder="{:$vo['placeholder']}" value="{:timeDef($value,'','Y-m-d H:i')}" data-locale="zh-cn" data-format="YYYY-MM-DD HH:mm" data-side-by-side="true"/>
    </div>
    
    <?php elseif ($vo['type'] == 'time'): ?>
    <div class="form-group col-md-12">
        <label for="{:$field}">{:$vo['name']} {:in_array('required',$vo['valids'])?'<span class="text-orange">*</span>':''}</label>
        
            <input class="js-datetimepicker form-control" autocomplete="off" id="{:$field}" name="{:$field}" placeholder="{:$vo['placeholder']}" value="{:timeDef($value,'','H:i')}" data-locale="zh-cn" data-format="HH:mm"/>
    </div>
    <?php endif ?>
<?php endforeach ?>
